package com.ljw.aop;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * Exception in thread "main" java.lang.ClassCastException: com.sun.proxy.$Proxy17 cannot be cast to com.ljw.dao.IndexDaoImpl
 * @Author: lijunwei
 * @Time: 2019/8/25 20:03
 * Declaring an Aspect  1.声明一个切面
 */
@Component
@Aspect
public class LjwAspect {
    //2.声明一个Pointcut:  定义aop应用到哪些类哪些方法上
    @Pointcut("execution(* com.ljw.dao.*.*(..))")
    private void pointcut() {

    }


    @Before("pointcut()")//advice: 通知
    public void doAccessCheck() {
        System.out.println("------前置通知------");
    }
}
